<template>
    <div>
        <div class="container">
            <div class="demo">
                <wxc-minibar title="红包记录"
                             background-color="#009ff0"
                             text-color="#FFFFFF"
                             @wxcMinibarLeftButtonClicked="minibarLeftButtonClick"
                             @wxcMinibarRightButtonClicked="minibarRightButtonClick"></wxc-minibar>
            </div>
        </div>
        <div class="zhichi" style="background-color:red" @click=" zhichu(event)">
            <text @click="">支出红包</text>
        </div>
        <div class="zhichi" style="background-color: deepskyblue" @click="shouru(event)">
            <text>收入红包</text>
        </div>
    </div>

</template>

<script>
    import { WxcMinibar } from 'weex-ui';
    var navigator = weex.requireModule('navigator');
    var modal = weex.requireModule('modal');
    export default {
        components: { WxcMinibar },
        methods: {
            minibarLeftButtonClick() {
            },
            minibarRightButtonClick() {
                modal.toast({'message': 'click rightButton!', 'duration': 1});
            },
            qqq(){
                var bundleUrl = this.$getConfig().bundleUrl;
                bundleUrl = new String(bundleUrl);
                var nativeBase;
                var isAndroidAssets = bundleUrl.indexOf('file://assets/') >= 0;

                var isiOSAssets = bundleUrl.indexOf('file:///') >= 0 && bundleUrl.indexOf('WeexDemo.app') > 0;
                if (isAndroidAssets) {
                    nativeBase = 'file://assets/dist/';
                }
                else if (isiOSAssets) {
                    nativeBase = bundleUrl.substring(0, bundleUrl.lastIndexOf('/') + 1);
                }
                else {
                    var host = 'localhost:8081';
                    var matches = /\/\/([^\/]+?)\//.exec(bundleUrl);
                    if (matches && matches.length >= 2) {
                        host = matches[1];
                    }
                    nativeBase = 'http://' + host + '/dist/';
                }
                this.baseURL = nativeBase;
            },
            /*处理登录*/
            zhichu(event) {
                this.qqq();
                navigator.push({
                    url: this.baseURL+'costBabi.js',
                    animated: "true"
                }, event => {
                    modal.toast({ message: 'callback: ' + event })
                })
            },
            shouru(event) {
                this.qqq();
                navigator.push({
                    url: this.baseURL+'getBabi.js',
                    animated: "true"
                }, event => {
                    modal.toast({ message: 'callback: ' + event })
                })
            },
        }}
</script>
<style>
    .zhichi{
        width: 710px;
        min-height:120px;
        border-width: 1px;
        border-color:black;
        margin-left: 20px;
        margin-top: 20px;
        display: flex;
        display: -webkit-flex;
        flex-wrap: wrap;
        flex-direction:row;
        justify-content:center;
        font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
        align-items: center;
        background-color: red;
        color: #ffffff;
        border-radius: 30px;
    }
</style>